package com.tiany.java_study_exercise.BankTest;

public class Bank {
    private Customer[] customers;
    private int numberOfCustomer;

    //构造器
    public Bank(){
        customers =new Customer[10];
    }
    //添加客户
    public void addCustomer(String f,String l){
        Customer customer=new Customer(f,l);
        customers[getNumberOfCustomer()]=customer;
        numberOfCustomer++;
    }
    //获取客户
    public Customer getCustomer(int index) {
        if (index<=customers.length && index>=0){
            return customers[index];
        }else{
            System.out.println("data error!");
            return null;
        }
    }

    public int getNumberOfCustomer() {
        return numberOfCustomer;
    }
}
